/*
* @Date: 2020/4/15
* @Author: XueChengwu <xuechengwu@erayt.com>
* @Copyright: 2015-2019 Erayt, Inc.
* @Description: If you have some questions, please contact: xuechengwu@erayt.com.
*/
import React from 'react';
import 'codemirror/lib/codemirror.css';
import CodeMirror from 'codemirror/lib/codemirror';
import 'codemirror/mode/jsx/jsx';
import 'codemirror/mode/javascript/javascript';
import './index.scss';

export default class extends React.Component{
  constructor(props) {
    super(props);
    this.myRef = React.createRef();
  }

  componentDidMount() {
    this.codeMirror = CodeMirror.fromTextArea(this.myRef.current, {
      mode: 'text/jsx',
      lineNumbers: true,
    });
  }

  render() {
    return (
      <div className="editor-frameworker">
        <div className="editor-wrapper">
          <textarea ref={this.myRef} className="code-mirror" onChange={this.onChangeCode}></textarea>
        </div>
      </div>
    );
  }
}
